import Mock from 'mockjs'
import index from '@/mock/apis/index'
import login from '@/mock/apis/login'
import cancel from './apis/cancel'
import completed from './apis/completed'
import doing from './apis/doing/doing'
import pending from './apis/pending/pending'

import { MockParams } from './index.d'
const mocks = [...login, ...index, ...cancel, ...completed, ...doing, ...pending]
//设置延时时间
Mock.setup({
  timeout: '300'
})

export function mockXHR() {
  let mock: MockParams
  for (mock of mocks) {
    Mock.mock(new RegExp(mock.url), mock.type || 'get', mock.response)
  }
}
